package servlet;

import dto.CompanyModelDto;

import model.CompanyModel;
import model.NavModel;
import model.ProductModel;
import service.ICommonService;
import service.IProductService;
import service.impl.CommonServiceImpl;
import service.impl.ProductServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet("/product")
public class ProductServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        ICommonService iCommonService =new CommonServiceImpl();
        req.setAttribute("companyModel", iCommonService.getCommonModelDto());
//        req.setAttribute("companyModel", new CompanyModelIo().getCompanyModel());
        //导航
//        req.setAttribute("navList", new NavModelIo().getNavListFromNote());//这是导航数据
        //菜系导航+内容
//        req.setAttribute("productModel",new ProductModelIo().getFromIo());//转发数据
        IProductService s =new ProductServiceImpl();
        req.setAttribute("productModel",s.getProductModel());

        req.getRequestDispatcher("/jsp/product.jsp").forward(req,resp);
    }
}
